package com.ty.controller;

import com.ty.pojo.User;
import com.ty.service.UserService;
import com.ty.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@RestController
@CrossOrigin
@EnableSwagger2
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    //校验用户
    @PostMapping("/authUser")
    public SysResult authUser(User user){
        String token = userService.authUser(user);
        System.out.println(user);
        if (StringUtils.hasLength(token)){
            return SysResult.success(token);
        }else {
            return SysResult.fail();
        }
    }
}
